﻿using System;
using System.Collections;
using System.Collections.Generic;

using EnvDTE;

namespace Microsoft.WowAddonStudio.Automation
{
    public class CodeElements : List<CodeElement>, EnvDTE.CodeElements
    {
        private readonly DTE dte;
        private readonly object parent;

        public CodeElements(DTE dte, object parent)
        {
            if (dte == null)
                throw new ArgumentNullException("dte");
            if (parent == null)
                throw new ArgumentNullException("parent");

            this.dte = dte;
            this.parent = parent;
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }

        IEnumerator EnvDTE.CodeElements.GetEnumerator()
        {
            return GetEnumerator();
        }

        public CodeElement Item(object index)
        {
            if (index == null)
                throw new ArgumentNullException("index");
            if (index.GetType() != typeof(int))
                throw new ArgumentException("Index type mismatch.", "index");

            return this[(int)index];
        }

        public void Reserved1(object Element)
        {
        }

        public bool CreateUniqueID(string Prefix, ref string NewName)
        {
            return false;
        }

        public DTE DTE
        {
            get { return dte; }
        }

        public object Parent
        {
            get { return parent; }
        }
    }
}
